<template>
	<view>
		<u-tabbar :before-switch="beforeSwitch" active-color="#B3723E" icon-size="50" v-model="current" :border-top="false" :list="list">	</u-tabbar>
		<RegisterModal :registerShow="showModal" @close="close"></RegisterModal>
	</view>
</template>

<script>
	import RegisterModal from '@/components/RegisterModal.vue'
	export default {
		components:{
			RegisterModal
		},
		data() {
			return {
				list: [{
						iconPath: "homepage",
						selectedIconPath: "homepage_fill",
						text: "酒局",
						pagePath: "/pages/home/home",
						customIcon: true
					},
					{
						iconPath: "headlines",
						selectedIconPath: "headlines_fill",
						text: "人脉",
						pagePath: "/pages/group/group",
						customIcon: true
					},
					{
						iconPath: "faxian-01",
						selectedIconPath: "faxian2",
						text: "发现",
						pagePath: "/pages/news/news",
						customIcon: true
					},
					{
						iconPath: "order",
						selectedIconPath: "order_fill",
						text: "活动",
						pagePath: "/pages/demand/demand",
						customIcon: true
					},
					{
						iconPath: "people",
						selectedIconPath: "people_fill",
						text: "我的",
						pagePath: "/pages/mine/mine",
						customIcon: true
					},
				],
				current: 0,
				showModal: false,
			};
		},
		methods: {
			beforeSwitch(index){
				const userStauts = uni.getStorageSync("user_status")
				if(index == 4 && userStauts == 0){
					this.showModal = true
				}else{
					return true
				}
			},
			changeTabbar(index) {
				uni.switchTab({
					url: `${this.list[index].pagePath}`
				})
			},
			close(){
				this.showModal = false
			}
		}
	};
</script>

<style lang="scss">
</style>